package com.ruoyi.web.controller.signer;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SealJur;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.service.ISealJurService;
import com.ruoyi.system.service.ISealJurSignerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 个人印章转授Controller
 * 
 * @author ess
 * @date 2021-11-03
 */
@RestController
@RequestMapping("/signer/sealtempjur")
public class SealTempJurController extends BaseController
{
    @Autowired
    private ISealJurSignerService sealJurSignerService;


    /**
     * 查询个人印章转授列表
     */
    @PreAuthorize("@ss.hasPermi('signer:sealtempjur:list')")
    @GetMapping("/list")
    public TableDataInfo list(SealJur sealJur)
    {
        LoginUser loginUser = getLoginUser();
        sealJur.setSealPersonId(loginUser.getUser().getPersonId());

        startPage();
        List<SealJur> list = sealJurSignerService.selectSealJurSignerList(sealJur);
        return getDataTable(list);
    }


    /**
     * 获取个人印章转授详细信息
     */
    @PreAuthorize("@ss.hasPermi('signer:sealtempjur:query')")
    @GetMapping(value = "/{sealJurId}")
    public AjaxResult getInfo(@PathVariable("sealJurId") String sealJurId)
    {
        return AjaxResult.success(sealJurSignerService.selectSealJurSignerBySealJurId(sealJurId));
    }


    /**
     * 删除个人印章转授
     */
    @PreAuthorize("@ss.hasPermi('signer:sealtempjur:remove')")
    @Log(title = "个人印章转授", businessType = BusinessType.DELETE)
	@DeleteMapping("/{sealJurIds}")
    public AjaxResult remove(@PathVariable String[] sealJurIds)
    {
        return toAjax(sealJurSignerService.deleteSealJurBySealJurSignerIds(sealJurIds));
    }
}
